package com.demo.jpa.service;

import com.demo.jpa.dao.entity.RoleEntity;
import com.demo.jpa.dao.repository.RoleRepository;
import lombok.extern.log4j.Log4j2;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

/**
 * @Author:LiaoYouLe
 * @Date: Created in 2018/7/27
 * @Description
 * @Modifyied By:
 */

@Log4j2
public class GraphTry extends TestCase {
    @Autowired
    private RoleRepository roleRepository;

    @Test
    public void existN1Issue() {
        List<RoleEntity> roles = roleRepository.findAll();
        for (RoleEntity role : roles) {
            log.info("====\n\t 角色 {} ,权限 {}", role.getRname(), role.getPrivileges());
        }
    }

    @Test
    public void enoN1Issue() {
        List<RoleEntity> roles = roleRepository.findDistinctByRidNotNull();
        for (RoleEntity role : roles) {
            log.info("====\n\t 角色 {} ,权限 {}", role.getRname(), role.getPrivileges());
        }
    }
}
